# !/bin/usr/python
# _*_ coding=utf-8 _*_
# Filename : request_postfile_res.py

import time
import cgi
import msvcrt
import os

# 二进制文件处理
msvcrt.setmode( 0, os.O_BINARY )

try:
	form = cgi.FieldStorage()

	# itemname = form['item'].name
	filename = form['file1'].filename
	# filevalue = form['item'].value

	# file写入
	fp = open( filename, 'wb' )
	fp.write( form['file1'].value )
	fp.close()

	print ('Status: 200 OK')
	print ('Content-Type: text/html')
	# print ('Content-Encoding: gzip')
	print ('')
	print ('server reception!')
except Exception as ee:
	print ('Status: 400')


